Skip to content

Add support for split DNS#1274

Open
elsoa-invitech wants to merge 1 commit into
adrienverge:masterfrom
elsoa-invitech:splitdns-to-env
Open

Add support for split DNS#1274
elsoa-invitech wants to merge 1 commit into
adrienverge:masterfrom
elsoa-invitech:splitdns-to-env

Conversation

@elsoa-invitech
Copy link
Copy Markdown

Forti can send multiple split dns config in xml:

<split-dns domains='office.intra,dmz.intra' dnsserver1='10.10.20.5' dnsserver2='10.10.20.6' /><split-dns domains='others.intra' dnsserver1='172.28.1.30' dnsserver2='172.28.1.31' />

This means, use one dns server for domain A+B, and use another dns server for domain C.

This patch parse the /remote/fortisslvpn_xml response to get the split-dns configuration, and pass the info to envs, same logic as ip4 routes.

Parse the /remote/fortisslvpn_xml response to get the split-dns
configuration.
@DimitriPapadopoulos
Copy link
Copy Markdown
Collaborator

How does setting environment variables VPN_SPLITDNS_... help?

@elsoa-invitech
Copy link
Copy Markdown
Author

pppd gets this envs (same as VPN_ROUTE_*), and setup dnsmasq to handle multi splitsdns situation. (systemd-resolved doest support splitdns in same interface :( )

@elsoa-invitech
Copy link
Copy Markdown
Author

And this is the other side which collects the envs and pass to network manager:
elsoa-invitech/network-manager-fortisslvpn@master-jammy...splitdns-dev

(that code is still in WIP!)

@DimitriPapadopoulos
Copy link
Copy Markdown
Collaborator

This doesn't work with plain openfortivpn.

@elsoa-invitech
Copy link
Copy Markdown
Author

what is not working for you? have you <split-dns ...> settings in your fortissl_xml?

@DimitriPapadopoulos
Copy link
Copy Markdown
Collaborator

openfortivpn handles DNS internally by default.

@elsoa-invitech
Copy link
Copy Markdown
Author

elsoa-invitech commented Mar 10, 2025

openfortivpn handles DNS internally by default.

Sure. if you run openfortivpn in standalone.

With network-manager (gui), ip+routing+dns settings are handled by NM. Thats why ip/dns/routing rules are passed to envvars, and pickup by the linked networkmanager plugin. With this patch splitdns infos are set to env too and nm plugin can/will handle it.

@DimitriPapadopoulos
Copy link
Copy Markdown
Collaborator

Because this is the repository for the standalone openfortivpn, adding features unrelated to the standalone case is not really an option. Let me try to find some common ground.

My vision for the long term evolution of openfortivpn is as follows:

  1. Drop pppd and use embedded PPP code instead.
  2. Switch to an external script such as vpnc-script to set up routing and DNS parameters when the tunnel goes up and down. The script will handle IPv6, split DNS, systemd. End-users could write their own script to customize routing and DNS.
  3. We could even split openfortivpn into a library and a CLI, with NM using only the library.

Because vpnc-script expects parameters as environment variables, setting up environment variables doesn't sound bad. However, environment variables should be identical to the ones expected by vpnc-script to allow a smooth future transition to vpnc-script. How about having a look at that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants